#include "widget.h"
#include "ui_widget.h"
#include "thread.h"
#include <QDebug>
#include <QWaitCondition>
#include <QSemaphore>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    //创建两个线程对象
    Thread td1;
    Thread td2;
    //启动线程
    td1.start();
    td2.start();

    //线程等待
    td1.wait();
    td2.wait();

    //打印结果
    qDebug() << Thread::num;

    QSemaphore sem;
    sem.acquire();

}

Widget::~Widget()
{
    delete ui;
}

